#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    int missingNumber(vector<int>& nums)
    {
        vector<int> hash(nums.size() + 1, 0);
        for (int i = 0;i < nums.size();++i)
        {
            hash[nums[i]] = 1;
        }
        for (int i = 0;i < hash.size();++i)
        {
            if (hash[i] == 0)
            {
                return i;
            }
        }
        return 0;
    }
};